package com.cc.crm.controller;

import com.cc.crm.pojo.ShareCustomer;
import com.cc.crm.service.ShareCustomerService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program:
 * @ClassName:
 * @description:
 * @author: zgc
 * @date:
 * @Version 1.0
 **/
@Controller
@RequestMapping("/share")
public class ShareCustomerController {
    @Resource
    private ShareCustomerService shareCustomerService;
    
    //共享客户信息
    @RequestMapping("/shareCustomer")
    @ResponseBody
    public int shareCustomer(ShareCustomer shareCustomer) {
        List<ShareCustomer> shareCustomerList=shareCustomerService.selectShareCustomer(shareCustomer);
        if (shareCustomerList.isEmpty()) {
            int i = shareCustomerService.shareCustomer(shareCustomer);
            return i;
        }
        return 0;
    }
}
